@SuppressWarnings("all")
public class D6 {
    // variable define
    int localval = 10;

    public class InnerClass {
        int socketid;// instance var

        InnerClass() {
            System.out.println("Inner class pop out a instance, ME");
        }

        void innerMethod() {
            System.out.println("I can do a lot thing to help the D6 class");
        }
    }

    public class InternalClass {
        static final int classvar = 0;// this class class-var
        private int cannotaccessid;// private field in this class

        void doMeAFavor() {
            System.out.println("Would you do me a favor?");
        }
    }

    public static void main(String[] args) {
        D6 d = new D6();// Do not do, InnerClass ic = new InnerClass();
        InnerClass ic = d.new InnerClass();
        ic.socketid = 1;
        System.out.println("socketid " + ic.socketid);
        InternalClass inter = d.new InternalClass();
        System.out.println("class var" + inter.classvar);

        ic.innerMethod();
        inter.doMeAFavor();

        int a = 10, b = 20;
        makeSwapInt(a, b);
        System.out.println("Actually: " + a + " " + b);// 10 20, so it is not swap when the type is simple as int,
                                                       // float(for basic type)

        Integer ref_a = new Integer(a);
        Integer ref_b = new Integer(b);
        makeSwapRefInt(ref_a, ref_b);
        System.out.println("Actually ref: " + ref_a + " " + ref_b);// still 10 20, what the fuck!!!
    }

    public static void makeSwapInt(int x, int y) {
        int tmp = x;
        x = y;
        y = tmp;
    }

    public static void makeSwapRefInt(Integer x, Integer y) {
        Integer tmp = new Integer(x);
        x = y;
        y = tmp;
    }
}
